const express = require('express')
const bodyParser = require('body-parser')
const path = require('path')
const app = express()


app.use(express.static(path.join(__dirname, 'public')))
app.use(bodyParser.urlencoded())
app.post('/post1', (req, res) => {
    res.send('hello ajax post')
})
app.post('/post2', (req, res) => {
    console.log(req.body);
    res.send(`您已注册成功, 您的账号是${req.body.username},您的密码是${req.body.password}`)
})
app.post('/post3', (req, res) => {
    console.log(req.body);
    res.send(req.body)
})
let server = app.listen(3000, () => {
    console.log('服务已经运行在3000端口');
})